settings->setValue(QLatin1String(versionC), maxAccountsVersion);
for (const auto &acc : std::as_const(_accounts)) {
settings->beginGroup(acc->account()->id());
- saveAccountHelper(acc->account().data(), *settings, saveCredentials);
+ saveAccountHelper(acc->account(), *settings, saveCredentials);
settings->endGroup();
}
qCInfo(lcAccountManager) << "Saved all account settings, status:" << settings->status();
}
-void AccountManager::saveAccount(Account *newAccountData)
+void AccountManager::saveAccount(const AccountPtr &newAccountData)
{
qCDebug(lcAccountManager) << "Saving account" << newAccountData->url().toString();
const auto settings = ConfigFile::settingsWithGroup(QLatin1String(accountsC));
qCDebug(lcAccountManager) << "Saved account state settings, status:" << settings->status();
}
-void AccountManager::saveAccountHelper(Account *account, QSettings &settings, bool saveCredentials)
+void AccountManager::saveAccountHelper(const AccountPtr &account, QSettings &settings, bool saveCredentials)
{
qCDebug(lcAccountManager) << "Saving settings to" << settings.fileName();
settings.setValue(QLatin1String(versionC), maxAccountVersion);
public slots:
/// Saves account data when adding user, when updating e.g. dav user, not including the credentials
- void saveAccount(OCC::Account *newAccountData);
+ void saveAccount(const OCC::AccountPtr &newAccountData);
/// Saves account state data, not including the account
void saveAccountState(OCC::AccountState *a);
private:
// saving and loading Account to settings
- void saveAccountHelper(Account *account, QSettings &settings, bool saveCredentials = true);
+ void saveAccountHelper(const AccountPtr &account, QSettings &settings, bool saveCredentials = true);
AccountPtr loadAccountHelper(QSettings &settings);
bool restoreFromLegacySettings();
if (_account->url() != url) {
qCInfo(lcConnectionValidator()) << "status.php was redirected to" << url.toString();
_account->setUrl(url);
- emit _account->wantsAccountSaved(_account.data());
+ emit _account->wantsAccountSaved(_account);
}
if (!serverVersion.isEmpty() && !setAndCheckServerVersion(serverVersion)) {
}
_account->setCredentialSetting(userC, _user);
- emit _account->wantsAccountSaved(_account);
+ emit _account->wantsAccountSaved(_account->sharedFromThis());
// write cert if there is one
if (!_clientSslCertificate.isNull()) {
_davUser = newDavUser;
- emit wantsAccountSaved(this);
+ emit wantsAccountSaved(sharedFromThis());
emit prettyNameChanged();
}
if (!approvedCerts.isEmpty()) {
QSslConfiguration::defaultConfiguration().addCaCertificates(approvedCerts);
addApprovedCerts(approvedCerts);
- emit wantsAccountSaved(this);
+ emit wantsAccountSaved(sharedFromThis());
// all ssl certs are known and accepted. We can ignore the problems right away.
qCInfo(lcAccount) << out << "Certs are known and trusted! This is not an actual error.";
void Account::resetShouldSkipE2eeMetadataChecksumValidation()
{
_skipE2eeMetadataChecksumValidation = false;
- emit wantsAccountSaved(this);
+ emit wantsAccountSaved(sharedFromThis());
}
int Account::serverVersionInt() const
_encryptionCertificateFingerprint = fingerprint;
_e2e.usbTokenInformation()->setSha256Fingerprint(fingerprint);
Q_EMIT encryptionCertificateFingerprintChanged();
- Q_EMIT wantsAccountSaved(this);
+ Q_EMIT wantsAccountSaved(sharedFromThis());
}
void Account::setAskUserForMnemonic(const bool ask)
void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *);
// e.g. when the approved SSL certificates changed
- void wantsAccountSaved(OCC::Account *acc);
+ void wantsAccountSaved(const OCC::AccountPtr &acc);
void wantsFoldersSynced();
// it's just written if it gets passed into the constructor.
_account->setCredentialSetting(QLatin1String(clientCertBundleC), _clientCertBundle);
}
- emit _account->wantsAccountSaved(_account);
+ emit _account->wantsAccountSaved(_account->sharedFromThis());
// write secrets to the keychain
if (!_clientCertBundle.isEmpty()) {